home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_08_1985_Transactor_Publishing.d64
/
star 0.14
< prev
next >
Wrap
Text File
|
2023-02-26
|
910b
|
43 lines
0010 // "STAR" - this is a sample comal
0020 // program to draw a star of any
0030 // number of points.
0040 // comal 0.14 version
0050 // * transactor magazine - cz *
0060 dim a$ of 1
0070 print chr$(147),
0080 siz:=100
0090 while true do
0100 print chr$(19),
0110 settext
0120 input "number of points? ": points
0130 setgraphic 0
0140 clear
0150 home
0160 pendown
0170 star(siz,points)
0180 input a$
0190 endwhile
0200 end
0210 //
0220 proc star(siz,points) closed
0230 // ** draw an n-pointed star **
0240 // first calculate the angle to
0250 // turn at each point
0260 case (points mod 4) of
0270 when 0
0280 angvar:=points
0290 when 2
0300 angvar:=points/2
0310 otherwise
0320 angvar:=points*2
0330 endcase
0340 angle:=180-360/angvar
0350 //
0360 // now draw the star
0370 setheading ((180-angle)/2)
0380 for i:=1 to points do
0390 forward (siz)
0400 right (angle)
0410 endfor i
0420 endproc star